<?php
namespace app\common\model;
use think\Db;
/**
 * 技工服务分类模型
 */
class SkillServiceCat extends Base {
	/**
	 * 列表
	 */
	public function listQuery($parentId = 0){
		$parentId = $parentId ? $parentId : input('parentId',0);
		$where[] = ['dataFlag','=',1];
		$where[] = ['isShow','=',1];
		$where[] = ['parentId','=',$parentId];
		$rs = $this->where($where)
			->field('catId,catTitle,isShow,dataSort')
			->order('catId','asc')
			->select();
		return $rs;
	}
	/**
	 * 获取分类名称
	 */
	public function getCatTitles($catIdPath){
		if($catIdPath == '')return '';
		$catIds = str_replace("_",",",substr($catIdPath, 0, -1));
		$rs = $this->where("dataFlag=1 and catId in(".$catIds.")")->column('catTitle');
		if(!empty($rs)){
			return implode('→',$rs);
		}
	}
}